#include "BioEntity.h"
#include <iostream>

using namespace std;
BioEntity::BioEntity(const Ogre::String &name,
				  OgreBulletDynamics::DynamicsWorld *world,
				  const short collisionGroup,
				  const short collisionMask) :
				  RigidBody(name,world,collisionGroup,collisionMask)
{

    lifeState = ALIVE;
    energy = 100.0;
    idleConsumption = 0.001;
}

BioEntity::~BioEntity()
{
    //dtor
}

void BioEntity::stepBioSimulation(Real elapsedTime) {
	if (lifeState == ALIVE) {
		// Consumes energy
		energy -= idleConsumption * elapsedTime;

		// If energy goes below zero, it dies;
		if (energy < 0) {
			lifeState = DEAD;
		}
	}

}

void BioEntity::collideWith(BioEntity* other) {
	cout << "Collision: " << this->getName() << " with " << other->getName() << endl;

}
